package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.entity.Order;

import java.util.List;

/**
 * 订单Mapper接口
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 根据用户ID查询订单列表
     */
    @Select("SELECT * FROM t_order WHERE user_id = #{userId}")
    List<Order> selectByUserId(@Param("userId") Long userId);

    /**
     * 根据订单状态查询订单列表
     */
    @Select("SELECT * FROM t_order WHERE order_status = #{orderStatus}")
    List<Order> selectByOrderStatus(@Param("orderStatus") String orderStatus);

    /**
     * 根据用户ID和订单状态查询订单列表
     */
    @Select("SELECT * FROM t_order WHERE user_id = #{userId} AND order_status = #{orderStatus}")
    List<Order> selectByUserIdAndOrderStatus(@Param("userId") Long userId, @Param("orderStatus") String orderStatus);
} 